Allow nullable locking directory in SupportSQLiteLock. Some family and mostly older devices don't properly create the cache directory and a null value can be returned by the context, to protect from such case the lock directory for process locking a database is not obligatory and the behaviour will fallback as it used to before the process lock, i.e. only in-memory locking. Bug: 265353349 Test: Existing Change-Id: I13f5e6253afa33bdea69559b40f43298123cbb0d (cherry picked from commit on android-review.googlesource.com host: 265124d30f61f6c46ad967c6b55f6c34dffe7899) Merged-In: I13f5e6253afa33bdea69559b40f43298123cbb0d 
diff --git a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt index 3b79342..dc07eb9 100644 --- a/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt +++ b/sqlite/sqlite-framework/src/main/java/androidx/sqlite/util/ProcessLock.kt 
@@ -52,12 +52,12 @@  @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)  class ProcessLock(  name: String, - lockDir: File, + lockDir: File?,  private val processLock: Boolean  ) { - private val lockFile: File = File(lockDir, "$name.lck") + private val lockFile: File? = lockDir?.let { File(it, "$name.lck") }  @SuppressLint("SyntheticAccessor") - private val threadLock: Lock = getThreadLock(lockFile.absolutePath) + private val threadLock: Lock = getThreadLock(name)  private var lockChannel: FileChannel? = null    /** @@ -69,6 +69,9 @@  threadLock.lock()  if (processLock) {  try { + if (lockFile == null) { + throw IOException("No lock directory was provided.") + }  // Verify parent dir  val parentDir = lockFile.parentFile  parentDir?.mkdirs()